[libcxx] Add support for LLVM_USE_SANITIZER=Undefined LLVM_USE_SANITIZER=Undefined support was added to the LLVM CMake configuration. Update libc++'s handling of LLVM_USE_SANITIZER to support this as well. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@219987 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/CMakeLists.txt b/CMakeLists.txt index 12bbb50..3210757 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt
@@ -304,6 +304,9 @@ if (LLVM_USE_SANITIZER STREQUAL "MemoryWithOrigins") list(APPEND LIBCXX_CXX_FEATURE_FLAGS "-fsanitize-memory-track-origins") endif() + elseif (LLVM_USE_SANITIZER STREQUAL "Undefined") + list(APPEND LIBCXX_CXX_FEATURE_FLAGS + "-fsanitize=undefined -fno-sanitize=vptr,function -fno-sanitize-recover") else() message(WARNING "Unsupported value of LLVM_USE_SANITIZER: ${LLVM_USE_SANITIZER}") endif() diff --git a/test/lit.cfg b/test/lit.cfg index bed329f..fbeb827 100644 --- a/test/lit.cfg +++ b/test/lit.cfg
@@ -434,6 +434,11 @@ if san == 'MemoryWithOrigins': self.compile_flags += ['-fsanitize-memory-track-origins'] self.config.available_features.add('msan') + elif san == 'Undefined': + self.compile_flags += ['-fsanitize=undefined', + '-fno-sanitize=vptr,function', + '-fno-sanitize-recover'] + self.config.available_features.add('ubsan') else: self.lit_config.fatal('unsupported value for ' 'libcxx_use_san: {0}'.format(san))